#ifndef ITEMOPTIONRELATEDTOFLAG_H
#define ITEMOPTIONRELATEDTOFLAG_H

#include <QMetaEnum>
#include "config/ConfigItem.h"

class QComboBox;
class ItemFlag;

class ItemOption : public ConfigItem
{
    Q_OBJECT
public:
    int get()
    {
        return m_option;
    }
    void set(int i)
    {
        m_option = i;
        emit itemEdited();
    }
    ItemFlag *getItemFlag()
    {
        return m_itemFlag;
    }
    void setItemFlag(ItemFlag *flag);

protected:
    QWidget *createWidget(WidgetStyle s) override;
    void update(QWidget *widget, UpdateOption option) override;
    void writeToData(QDataStream &stream) const override;
    void readFromData(QDataStream &stream) override;

private:
    QMetaEnum m_enum;
    ItemFlag *m_itemFlag = nullptr;
    int m_option = -1;
    void setComboBoxItems(QComboBox *comboBox);

private slots:
    void onFlagsEdited();
};



#endif // ITEMOPTIONRELATEDTOFLAG_H
